package com.topisv.tms.repository;

import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;

import com.topisv.tms.entity.Customers;

public interface CustomersDao extends PagingAndSortingRepository<Customers, Long>, JpaSpecificationExecutor<Customers> {

	Customers findByCustomerCode(String customerCode);
	
	@Modifying
	@Query("update  Customers set endNumber=? where customerCode=?")
	void updateEndNumber(String endNumber,String code);
	
	@Modifying
    @Query("update  Customers set distributeWarehouseState=?1 where customerCode=?2")
    void updateDistributeWarehouseState(String state , String customerCode);
	
	@Modifying
    @Query("update  Customers set stockQueryType=?1 where customerCode=?2")
    void updateStockQueryType(String type , String customerCode);
	
	@Modifying
    @Query("update  Customers set primeWarehouseCode=?1 where customerCode=?2")
    void updatePrimaryWarehouse(String primeWarehouseCode , String customerCode);
}
